<?php

namespace backend\modules\home\models;

use Yii;
use yii\behaviors\TimestampBehavior;
/**
 * This is the model class for table "lw_link".
 *
 * @property int $id
 * @property string $title
 * @property string $url
 * @property int $created_at
 * @property int $updated_at
 */
class Link extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return 'lw_link';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['title'], 'required'],
            [['sort', 'created_at', 'updated_at'], 'integer'],
            [['title'], 'string', 'max' => 64],
            [['url'], 'string', 'max' => 128],
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'title' => '标题',
            'url' => '链接',
            'sort' => '排序',
            'created_at' => '创建时间',
            'updated_at' => '更新时间',
        ];
    }

    public function behaviors()
    {
        return [
            [
                'class' => TimestampBehavior::className(),
                'createdAtAttribute' => 'created_at',
                'updatedAtAttribute' => 'updated_at',
            ],
        ];
    }
}
